package com.xnewtech.xplatform.swan.model.exp;

import com.xnewtech.xplatform.swan.model.enums.exp.AbstractBaseException;
import lombok.Getter;
import lombok.Setter;

/**
 * 业务异常的封装
 *
 * @author xnew
 * @date 2016年11月12日 下午5:05:10
 */
@Getter
@Setter
public class ServiceException extends RuntimeException {

    private Integer code;

    private String errorMessage;

    public ServiceException(Integer code, String errorMessage) {
        super(errorMessage);
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public ServiceException(AbstractBaseException exception) {
        super(exception.getMessage());
        this.code = exception.getCode();
        this.errorMessage = exception.getMessage();
    }

}
